package com.jzfai.controller;

import com.jzfai.entity.Role;
import com.jzfai.service.RoleService;
import com.jzfai.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Title: RoleController
 * @Description:
 * @Auther:kuanghua
 * @Version: 1.0
 * @create 2019/8/16 15:52
 */
@RestController
@RequestMapping("role")
public class RoleController {

    @Autowired
    RoleService roleService;

    @PostMapping("getListRole")
    public JsonData getListRole(@RequestBody Role role) {
        role.setPageNum((role.getPageNum() - 1) * role.getPageSize());
        return roleService.getListRole(role);
    }
    @PostMapping("addRole")
    public JsonData addRole(@RequestBody Role role){
        return roleService.addRole(role);
    }
    @PostMapping("editRole")
    public JsonData editRole(@RequestBody Role role){
        return roleService.editRole(role);
    }
    @PostMapping("deleteRole")
    public JsonData deleteRole(Integer id){
        return roleService.deleteRole(id);
    }
}
